if (!jsx3.lang.Class.forName("ux.cdb.admin.queries.excel.DetailDialog")) {

jsx3.Class.defineClass(
	"ux.cdb.admin.queries.excel.DetailDialog", jsx3.gui.Dialog, [],
	function (dialog) {
		/**
		 * Helper Functions, return a copy function with 
		 * @param fn {Function}
		 * @param scope {Object} 
		 */
		dialog.prototype.bind = function(fn, scope) {
			scope = scope || this;
			return function() {
				fn.apply(scope, arguments)
			}
		};

		dialog.prototype.initialize = function(){

			var me = this;
			this.parent = ux.megatron.Main.getServer().getBodyBlock().get('blkStudentQueryWorld');
			this.studentId = this.parent.matrix.getSelectedNodes().get(0).getAttribute("studentId");
			console.log('parent : \n',this.parent.matrix);
			ux.megatron.Main.loadUIResourceAsync(me.getDescendantOfName('tabBaseInfo').getContentPane(), "ux.cdb.admin", "ux/cdb/admin/customer/ui/det_baseinfo.xml", me, function(){
				ux.megatron.Main.loadUIResourceAsync(me.getDescendantOfName('tabAccount').getContentPane(), "ux.cdb.admin", "ux/cdb/admin/customer/ui/det_accinfo.xml", me, function(){
					ux.megatron.Main.loadUIResourceAsync(me.getDescendantOfName('tabStudy').getContentPane(), "ux.cdb.admin", "ux/cdb/admin/customer/ui/det_studyinfo.xml", me, function(){
						ux.megatron.Main.loadUIResourceAsync(me.getDescendantOfName('tabCareer').getContentPane(), "ux.cdb.admin", "ux/cdb/admin/customer/ui/det_careerinfo.xml", me, me.onDetailLoaded);
					});
				});
			});
		};
		
		dialog.prototype.onDetailLoaded = function(){
			var me = this;
			this.get('btnSeeStudyHistory')['onClick'] = this.bind(me.onSeeStudyHistory, me);
			this.get('btnSeeCareerHistory')['onClick'] = this.bind(me.onSeeCareerHistory, me);
			var details = this.getDescendantOfName('contentPane').getDescendantsOfType(ux.cdb.admin.dataautomate.GenericDetail);
			for(var i=0;i<details.length;i++){
				details[i].setDataEntityType(ux.cdb.admin.dataautomate.GenericDetail.Student);
				//details[i].setDataEntityType(ux.cdb.admin.dataautomate.GenericDetail.Contract);
				details[i].setDataEntityId(this.studentId);
				//details[i].setProcessHandler(handler);
				details[i].refreshData();
			}
			console.log('ux.cdb.admin.queries.excel.DetailDialog#onDetailLoaded...');
		};
		
		dialog.prototype.onSeeStudyHistory = function() {
			
			var parent = ux.megatron.Main.getServer().getBodyBlock();
			var me = this;
			this.hisType = "study";
			ux.megatron.Main.loadUIResourceAsync(parent,"ux.cdb.admin","ux/cdb/admin/customer/history/ui/hisDialog.xml", me, me.loadHisDialog);
		};
		
		dialog.prototype.onSeeCareerHistory = function() {
			
			var parent = ux.megatron.Main.getServer().getBodyBlock();
			var me = this;
			this.hisType = "career";
			ux.megatron.Main.loadUIResourceAsync(parent,"ux.cdb.admin","ux/cdb/admin/customer/history/ui/hisDialog.xml", me, me.loadHisDialog);
		};
		
		dialog.prototype.loadHisDialog = function(objEvent) {
			var hisDialog = objEvent.obj;
			
			hisDialog.studentId = this.studentId;
			hisDialog.hisType = this.hisType;
			hisDialog.loadUI();
		};

	});

}